home *** CD-ROM | disk | FTP | other *** search
/ Professional Soft Collection 1.02 / Professional Soft Collection 1.02.iso / communic / qmodempr / script.pak / MSI.SCR < prev    next >
Encoding:
Text File  |  1994-03-01  |  3.2 KB  |  130 lines

  1. '********************************************************************
  2. '
  3. ' This script calls MSI HQ BBS and uploads and downloads mail using
  4. ' the Tomcat mail door online.
  5. '
  6. '********************************************************************
  7.  
  8. ' Declare the DialModem subroutine (it appears later in the file)
  9.  
  10. declare sub DialModem
  11.  
  12. ' Dial the modem and wait for a connect.  Normally we wouldn't do this
  13. ' because this script would be run from a dialing directory entry and
  14. ' we would already be connected.
  15.  
  16. call DialModem
  17.  
  18. ' Set up a when on "-Pause-" to take care of the case where the sysop has
  19. ' a prelog screen with a pause in it.
  20.  
  21. when match "-Pause-" do send
  22.  
  23. ' Wait for name and password prompts and send the correct responses.
  24.  
  25. waitfor "first name"
  26. send "greg hewgill"
  27. waitfor "password"
  28. send "password"
  29.  
  30. ' Set up a number of match type whens to provide answers to various prompts
  31. ' and so on.
  32.  
  33. when match "] to continue" do send
  34. when match "view the bulletin menu" do send "N"
  35. when match "have new personal mail" do send "C"
  36. when match "protocol menu [" do send "Z"
  37.  
  38. ' A when quiet is used to press Enter whenever we don't get any characters
  39. ' for a particular amount of time (10 seconds in this case)
  40.  
  41. when quiet 10 do send
  42.  
  43. ' Set the default timeout to 60 seconds - if we don't get what we're looking
  44. ' for then just abort (below in the "catch err_timeout" section)
  45.  
  46. timeout 60
  47.  
  48. ' Make our way to the Tomcat main menu
  49.  
  50. waitfor "command"
  51. send "M"
  52. waitfor "command"
  53. send "T"
  54. waitfor "tomcat menu ["
  55.  
  56. ' Now we're at the Tomcat main menu.  Check to see if we have a REP file
  57. ' to upload.  If so, go ahead and send it up.
  58.  
  59. if exists("c:\dl\mustang.rep") then
  60.   send "U"
  61.   waitfor "now"
  62.   if upload("c:\dl\mustang.rep", Zmodem) = 0 then
  63.     del "c:\dl\mustang.rep"
  64.   end if
  65.   waitfor "tomcat menu ["
  66. end if
  67.  
  68. ' Now download the new mail.  We will provide a timeout of 200 seconds
  69. ' on the 'waitfor' that waits for the prompt at the end of the scan,
  70. ' that way if this takes a long time we won't just abort.
  71.  
  72. send "D"
  73. waitfor "would you like", 200
  74.  
  75. ' Respond to the download prompt and download the file
  76.  
  77. send "Y"
  78. waitfor "now", 120
  79. del "c:\dl\mustang.qwk"
  80. call download("c:\dl", Zmodem)
  81.  
  82. ' Wait for Tomcat to return to its menu and send the command to log off.
  83.  
  84. waitfor "tomcat menu ["
  85. send "G"
  86.  
  87. ' At this point the script will end and return to terminal mode.
  88.  
  89. end
  90.  
  91. ' This is a catch clause for the main program body, it handles timeout
  92. ' errors that are not otherwise handled.  If we get a timeout here, then
  93. ' there's not much we can do so we just hang up and abort.
  94.  
  95. catch err_timeout
  96.   hangup
  97.   end
  98.  
  99. '*****
  100. '
  101. ' This is a subroutine to dial a modem and wait for a connect.  Normally
  102. ' this would be handled with the dialing directory automatically (and this
  103. ' script would only be called after a connect).
  104. '
  105. '*****
  106.  
  107. sub DialModem
  108.   dim s as string
  109.   timeout 30
  110.   do
  111. tryagain:
  112.     send "ATDT0250"
  113.     do
  114.       receive s
  115.       if left(s, 7) = "CONNECT" then
  116.         exit sub
  117.       end if
  118.       if s = "NO CARRIER" or s = "BUSY" then
  119.         exit do
  120.       end if
  121.     loop
  122.     delay 1
  123.   loop
  124. catch err_timeout
  125.   send
  126.   print "timeout happened"
  127.   delay 1
  128.   goto tryagain
  129. end sub
  130.